<template>
    <div class="bodys">
        <Header :headerTxt="$t('ws_transition.sdd')" :showBack="true"></Header>
        <div class="content">
            <p>{{user.user_id}}</p>
            <div class="erwei">
            <div class="code" id="code">
            </div>
            </div>
        </div>
    </div>
</template>
<script>
import Header from "@/components/Header";
import QRCode  from "qrcodejs2"
import { getconf } from '@/api/getData'
export default {
    data(){
        return{
             user:JSON.parse(sessionStorage.getItem("user")),
            link:''
        }
    },
    methods: {
         qrcode (num) {

                let qrcode = new QRCode('code', {
                    width:num * 2,
                    height: num * 2,
                    Top:5,       // 高度
                    text:  url,   // 二维码内容
                    // render: 'canvas' ,   // 设置渲染方式（有两种方式 table和canvas，默认是canvas）
                    // background: '#f0f',   // 背景色
                    // foreground: '#ff0'    // 前景色
                })
            },
    async getData(){
        let data = {"kk":"download"}
      const res = await getconf(data);
      if(res!=null){
          this.link =res.data;
        let num = parseInt(document.querySelector('html').style.fontSize);
        this.qrcode(num);
      }
    },
    },
    components:{
         Header , QRCode
    },
    mounted(){ 
        this.getData();

        
    }
}
</script>
<style lang="stylus" scoped>
.content{
    position relative;
    background: url('../../assets/mine/backcode.png') no-repeat;
    background-size:100% 100%;
    width :100vw;
    height:100vh;
    >P{
        position: absolute;
        height: 8%;
        top: 23.5%;
        font-size: 0.6rem;
        width: 100%;
        text-align: center;
        line-height: 8%;
        color: #bd8f46;
    }
}
.code{
    position:absolute;
    width:29%;
    height:16%;
    overflow:hidden;
    top:40%;
    left:36%;
}
</style>